package cn.genmer.test.security.designpatterns.observer.myobserver;

import cn.genmer.test.security.designpatterns.observer.Observer;

/**
 * 具体的观察者实现
 */
public class XiaoMiObserver implements Observer {
    private double temperature;
    private double presure;
    private double humidity;
    @Override
    public void update(double temperature, double presure, double humidity) {
        // 这里实现了观察者接口方法，并执行了获取数据后的操作 -打印
        this.temperature = temperature;
        this.presure = presure;
        this.humidity = humidity;
        display();
    }

    public void display(){
        System.out.println(String.format("[小米天气]今天的温度为%s， 气压：%s，湿度是%s", temperature, presure, humidity));
    }
}
